// 公共资源模块
import Vue from 'vue'
// 公共样式
import '../assets/less/style.less'
import '../assets/less/font.css'
import nProgress from 'nprogress'
import 'nprogress/nprogress.css'
// 导入 Axios
import axios from 'axios'
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1'
// axios 请求拦截
axios.interceptors.request.use(config => {
  // 为请求头添加 token 验证字段
  config.headers.Authorization = window.sessionStorage.getItem('token')
  nProgress.start()
  return config
})
axios.interceptors.response.use(config => {
  nProgress.done()
  return config
})
Vue.prototype.$http = axios
